package com.wang.learn.cloudkafka.controller;/*
 * ******************************************************************************
 *
 *                       Woodare PROPRIETARY INFORMATION
 *
 *           The information contained herein is proprietary to Woodare
 *            and shall not be reproduced or disclosed in whole or in part
 *                     or used for any design or manufacture
 *               without direct written authorization from FengDa.
 *
 *             Copyright (c) 2021 by Woodare.  All rights reserved.
 *
 * ******************************************************************************
 */

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.kafka.core.KafkaTemplate;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

/** 生产者
 * ClassName KafkaProducer
 *
 * @author wang
 * Date 2021/9/16 15:31
 */
@RestController
public class KafkaController {

    @Autowired
    private KafkaTemplate<String, Object> kafkaTemplate;

    @GetMapping("/kafka/{message}")
    public void sendMessage(@PathVariable("message") String normalMessage) {
        kafkaTemplate.send("test1", normalMessage);
    }
}
